<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>数组</title>
    </head>
    <body>
        <?php
        $student[]="张三";
        $student[5]="李三";
        $student[8]="赵三";
        
        $teacher=array(1=>"aa",3=>"bb",5=>"cc");
        $p=array("name"=>"张三","age"=>20,"sex"=>"男");
        
        var_dump($student);
        var_dump($teacher);
        var_dump($p);
        
        
        
        $fff[]="苹果";//苹果、香蕉、柚子、芒果 、梨
        $fff[]="香蕉";
        $fff[]="柚子";
        $fff[]="芒果";
        $fff[]="梨";
        
        echo $fff[2];
        
        $hhh=array('广西壮族','南宁市','柳州市','桂林市','梧州市','北海市','防城港市','钦州市','贵港市','玉林市','百色市','贺州市','河池市','来宾市','崇左市');
        
        for($i=0;$i<count($hhh);$i++)
        {
            echo $hhh[$i];
        }
        echo "<hr/>";
        $arr=array("id"=>"1001","pname"=>"电脑","price"=>7000,"number"=>500);
        foreach ($arr as $k=>$v )
        {
            echo $k.'的值是'.$v."<br/>";
        }
        
        
        echo "<table border='1'>";
        echo "<tr>";
        for($i=0;$i<count($hhh);$i++) 
        {
            echo "<td>";
            echo $hhh[$i];
            echo "</td>";
        }
        echo "</tr>";
        echo "</table>";
        
        echo "<select name='city'>";
        foreach ($hhh as $v)
        {
            echo "<option>{$v}</option>";
        }
        echo "</select>";
        
        
        ?>
        
    </body>
</html>
